<?php

class Engine_Form_Decorator_AddThisTypes extends Zend_Form_Decorator_Abstract {
	/**
	 * Render
	 *
	 * Renders as the following:
	 * <dt></dt>
	 * <dd>$content</dd>
	 *
	 * @param  string $content
	 * @return string
	 */
	
	public function render($content) {
		$translate = Zend_Registry::get ( 'Zend_Translate' );
		$view = Zend_Registry::get ( 'Zend_View' );
		$value = Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'kowcore.addthis.type', 'type1' );
		
		$type1Checked = $value == 'type1' ? 'checked' : '';
		$type2Checked = $value == 'type2' ? 'checked' : '';
		$type3Checked = $value == 'type3' ? 'checked' : '';
		
		$baseUrl = $view->baseUrl ();
		
		$html = <<<EOF
<div class="form-wrapper" id="kowcore_addthis_type-wrapper">
  <div class="form-label" id="kowcore_addthis_type-label">
    <label class="optional" for="kowcore_tips">{$translate->translate('Add This')}</label>
  </div>
  <div class="form-element" id="kowcore_addthis_type-element">
    <p class="description">{$translate->translate('KOWCORE_ADDTHIS_TYPE_DESCR')}</p>
    <ul class="form-options-wrapper">
      <li>
        <div class='addthis_option'>
          <input type="radio" {$type1Checked} value="type1" id="kowcore_addthis_type-1" name="kowcore_addthis_type">
        </div>
        <label for="kowcore_tips-1">
          <img src="{$baseUrl}/application/modules/Kowcore/externals/images/addthis/type1.png" />
        </label>
      </li>
      <li>
        <div class='addthis_option'>
          <input type="radio" {$type2Checked} value="type2" id="kowcore_addthis_type-2" name="kowcore_addthis_type">
        </div>
        <label for="kowcore_tips-2">
          <img src="{$baseUrl}/application/modules/Kowcore/externals/images/addthis/type2.png" />
        </label>
      </li>
      <li>
        <div class='addthis_option'>
          <input type="radio" {$type3Checked} value="type3" id="kowcore_addthis_type-3" name="kowcore_addthis_type">
        </div>
        <label for="kowcore_tips-3">
          <img src="{$baseUrl}/application/modules/Kowcore/externals/images/addthis/type3.png" />
        </label>
      </li>
    </ul>
  </div>
</div>
EOF;
		
		return $html;
	}

}